class RefactorJaunts < ActiveRecord::Migration
  def self.up
    create_table :departures do |t|
      t.column :departure_time, :datetime, :null => false
      t.column :recorded_at, :datetime, :null => false
      t.column :recorded_by, :integer, :null =>  false
    end
    create_table :jaunt_returns do |t|
      t.column :return_time, :datetime, :null => false
      t.column :recorded_at, :datetime, :null => false
      t.column :recorded_by, :integer, :null =>  false
    end    
    remove_column :freshman_jaunts, :leave_time
    remove_column :freshman_jaunts, :return_time
    remove_column :freshman_jaunts, :leave_recorded_at
    remove_column :freshman_jaunts, :return_recorded_at
    add_column :freshman_jaunts, :departure_id, :integer, :null => true
    add_column :freshman_jaunts, :jaunt_return_id, :integer, :null => true   
  end

  def self.down
    drop_table :departures
    drop_table :jaunt_returns
    add_column :freshman_jaunts, :leave_time, :datetime, :null => false
    add_column :freshman_jaunts, :return_time, :datetime, :null => true
    add_column :freshman_jaunts, :leave_recorded_at, :datetime, :null => false
    add_column :freshman_jaunts, :return_recorded_at, :datetime, :null => true
    remove_column :freshman_jaunts, :departure_id
    remove_column :freshman_jaunts, :return_id
  end
end
